package com.uhylab.uhuvinetest;


import com.uhylab.uhuvinetest.dao.CloudHistory;
import com.uhylab.uhuvinetest.dao.LocalHistory;

/**
 * Created by xyb on 16/1/18 at UHylab
 *
 * @version 1.0
 */
public class DaoInset {
    private float[] lists;
    private String[] dds;
    private String string;
    private String tel;

    public DaoInset(float[] lists, String[] dds, String string, String tel) {
        this.lists = lists;
        this.dds = dds;
        this.string = string;
        this.tel = tel;
    }

    public LocalHistory start() {
        LocalHistory cloudHistory = new LocalHistory();
        cloudHistory.setLeukocytes(String.valueOf(lists[0]));
        if (dds[0].equals("正常")) {
            cloudHistory.setLeukocytes_status("0");
        } else if (dds[0].equals("轻微")) {
            cloudHistory.setLeukocytes_status("1");
        } else if (dds[0].equals("严重")) {
            cloudHistory.setLeukocytes_status("2");
        }else if (dds[0].equals("微量")) {
            cloudHistory.setLeukocytes_status("3");
        }
        cloudHistory.setNitrite(String.valueOf(lists[1]));
        if (dds[1].equals("正常")) {
            cloudHistory.setNitrite_status("0");
        } else if (dds[1].equals("轻微")) {
            cloudHistory.setNitrite_status("1");
        } else if (dds[1].equals("严重")) {
            cloudHistory.setNitrite_status("2");
        } else if (dds[1].equals("微量")) {
            cloudHistory.setNitrite_status("3");
        }


        cloudHistory.setUrobilinogen(String.valueOf(lists[2]));
        if (dds[2].equals("正常")) {
            cloudHistory.setUrobilinogen_status("0");
        } else if (dds[2].equals("轻微")) {
            cloudHistory.setUrobilinogen_status("1");
        } else if (dds[2].equals("严重")) {
            cloudHistory.setUrobilinogen_status("2");
        } else if (dds[2].equals("微量")) {
            cloudHistory.setUrobilinogen_status("3");
        }

        cloudHistory.setProtein(String.valueOf(lists[3]));
        if (dds[3].equals("正常")) {
            cloudHistory.setProtein_status("0");
        } else if (dds[3].equals("轻微")) {
            cloudHistory.setProtein_status("1");
        } else if (dds[3].equals("严重")) {
            cloudHistory.setProtein_status("2");
        }else if (dds[3].equals("微量")) {
            cloudHistory.setProtein_status("3");
        }
        cloudHistory.setPh(String.valueOf(lists[4]));
        if (dds[4].equals("正常")) {
            cloudHistory.setPh_status("0");
        } else if (dds[4].equals("轻微")) {
            cloudHistory.setPh_status("1");
        } else if (dds[4].equals("严重")) {
            cloudHistory.setPh_status("2");
        }else if (dds[4].equals("微量")) {
            cloudHistory.setPh_status("3");
        }
        cloudHistory.setBlood(String.valueOf(lists[5]));
        if (dds[5].equals("正常")) {
            cloudHistory.setBlood_status("0");
        } else if (dds[5].equals("轻微")) {
            cloudHistory.setBlood_status("1");
        } else if (dds[5].equals("严重")) {
            cloudHistory.setBlood_status("2");
        }else if (dds[5].equals("微量")) {
            cloudHistory.setBlood_status("3");
        }
        cloudHistory.setGravity(String.valueOf(lists[6]));
        if (dds[6].equals("正常")) {
            cloudHistory.setGravity_status("0");
        } else if (dds[6].equals("轻微")) {
            cloudHistory.setGravity_status("1");
        } else if (dds[6].equals("严重")) {
            cloudHistory.setGravity_status("2");
        }else if (dds[6].equals("微量")) {
            cloudHistory.setGravity_status("3");
        }
        cloudHistory.setKetones(String.valueOf(lists[7]));
        if (dds[7].equals("正常")) {
            cloudHistory.setKetones_status("0");
        } else if (dds[7].equals("轻微")) {
            cloudHistory.setKetones_status("1");
        } else if (dds[7].equals("严重")) {
            cloudHistory.setKetones_status("2");
        }else if (dds[7].equals("微量")) {
            cloudHistory.setKetones_status("3");
        }
        cloudHistory.setBilirubin(String.valueOf(lists[8]));
        if (dds[8].equals("正常")) {
            cloudHistory.setBilirubin_status("0");
        } else if (dds[8].equals("轻微")) {
            cloudHistory.setBilirubin_status("1");
        } else if (dds[8].equals("严重")) {
            cloudHistory.setBilirubin_status("2");
        }else if (dds[8].equals("微量")) {
            cloudHistory.setBilirubin_status("3");
        }
        cloudHistory.setGlucose(String.valueOf(lists[9]));
        if (dds[9].equals("正常")) {
            cloudHistory.setGlucose_status("0");
        } else if (dds[9].equals("轻微")) {
            cloudHistory.setGlucose_status("1");
        } else if (dds[9].equals("严重")) {
            cloudHistory.setGlucose_status("2");
        }else if (dds[9].equals("微量")) {
            cloudHistory.setGlucose_status("3");
        }
        cloudHistory.setAscorbicacid(String.valueOf(lists[10]));
        if (dds[10].equals("正常")) {
            cloudHistory.setAscorbicacid_status("0");
        } else if (dds[10].equals("轻微")) {
            cloudHistory.setAscorbicacid_status("1");
        } else if (dds[10].equals("严重")) {
            cloudHistory.setAscorbicacid_status("2");
        }else if (dds[10].equals("微量")) {
            cloudHistory.setAscorbicacid_status("3");
        }
        cloudHistory.setTelephone(tel);
        cloudHistory.setDate(string);
        return cloudHistory;
    }


    public CloudHistory start_cloud() {
        CloudHistory cloudHistory = new CloudHistory();
        cloudHistory.setLeukocytes(String.valueOf(lists[0]));
        if (dds[0].equals("正常")) {
            cloudHistory.setLeukocytes_status("0");
        } else if (dds[0].equals("轻微")) {
            cloudHistory.setLeukocytes_status("1");
        } else if (dds[0].equals("严重")) {
            cloudHistory.setLeukocytes_status("2");
        }
        cloudHistory.setNitrite(String.valueOf(lists[1]));
        if (dds[1].equals("正常")) {
            cloudHistory.setNitrite_status("0");
        } else if (dds[1].equals("轻微")) {
            cloudHistory.setNitrite_status("1");
        } else if (dds[1].equals("严重")) {
            cloudHistory.setNitrite_status("2");
        }

        cloudHistory.setUrobilinogen(String.valueOf(lists[2]));
        if (dds[2].equals("正常")) {
            cloudHistory.setUrobilinogen_status("0");
        } else if (dds[2].equals("轻微")) {
            cloudHistory.setUrobilinogen_status("1");
        } else if (dds[2].equals("严重")) {
            cloudHistory.setUrobilinogen_status("2");
        }

        cloudHistory.setProtein(String.valueOf(lists[3]));
        if (dds[3].equals("正常")) {
            cloudHistory.setProtein_status("0");
        } else if (dds[3].equals("轻微")) {
            cloudHistory.setProtein_status("1");
        } else if (dds[3].equals("严重")) {
            cloudHistory.setProtein_status("2");
        }
        cloudHistory.setPh(String.valueOf(lists[4]));
        if (dds[4].equals("正常")) {
            cloudHistory.setPh_status("0");
        } else if (dds[4].equals("轻微")) {
            cloudHistory.setPh_status("1");
        } else if (dds[4].equals("严重")) {
            cloudHistory.setPh_status("2");
        }
        cloudHistory.setBlood(String.valueOf(lists[5]));
        if (dds[5].equals("正常")) {
            cloudHistory.setBlood_status("0");
        } else if (dds[5].equals("轻微")) {
            cloudHistory.setBlood_status("1");
        } else if (dds[5].equals("严重")) {
            cloudHistory.setBlood_status("2");
        }
        cloudHistory.setGravity(String.valueOf(lists[6]));
        if (dds[6].equals("正常")) {
            cloudHistory.setGravity_status("0");
        } else if (dds[6].equals("轻微")) {
            cloudHistory.setGravity_status("1");
        } else if (dds[6].equals("严重")) {
            cloudHistory.setGravity_status("2");
        }
        cloudHistory.setKetones(String.valueOf(lists[7]));
        if (dds[7].equals("正常")) {
            cloudHistory.setKetones_status("0");
        } else if (dds[7].equals("轻微")) {
            cloudHistory.setKetones_status("1");
        } else if (dds[7].equals("严重")) {
            cloudHistory.setKetones_status("2");
        }
        cloudHistory.setBilirubin(String.valueOf(lists[8]));
        if (dds[8].equals("正常")) {
            cloudHistory.setBilirubin_status("0");
        } else if (dds[8].equals("轻微")) {
            cloudHistory.setBilirubin_status("1");
        } else if (dds[8].equals("严重")) {
            cloudHistory.setBilirubin_status("2");
        }
        cloudHistory.setGlucose(String.valueOf(lists[9]));
        if (dds[9].equals("正常")) {
            cloudHistory.setGlucose_status("0");
        } else if (dds[9].equals("轻微")) {
            cloudHistory.setGlucose_status("1");
        } else if (dds[9].equals("严重")) {
            cloudHistory.setGlucose_status("2");
        }
        cloudHistory.setAscorbicacid(String.valueOf(lists[10]));
        if (dds[10].equals("正常")) {
            cloudHistory.setAscorbicacid_status("0");
        } else if (dds[10].equals("轻微")) {
            cloudHistory.setAscorbicacid_status("1");
        } else if (dds[10].equals("严重")) {
            cloudHistory.setAscorbicacid_status("2");
        }
        cloudHistory.setTelephone(tel);
        cloudHistory.setCreatetime(string);
        return cloudHistory;
    }
}
